﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter21.ViewModel
{
    using System.Windows.Data;
    using System.Windows.Media;
    using System.Globalization;

    [ValueConversion(typeof(decimal), typeof(Brush))]
    public class PriceToBackgroundConverter : IValueConverter
    {
        public decimal MinimunPriceToHighligth { get; set; }
        public Brush HighlightBrush { get; set; }
        public Brush DefaultBrush { get; set; }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            decimal price = (decimal)value;
            if (price > MinimunPriceToHighligth)
                return HighlightBrush;
            else
                return DefaultBrush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
